﻿<?xml version="1.0" encoding="utf-8" ?>
<root>
  <table name="kp_FileSpaceInfo">
    <column name="ServerName" datatype="varchar(50)" />
    <column name="dtmStamp" datatype="datetime" />
    <column name="DBName" datatype="varchar(500)" />
    <column name="FileID" datatype="int" />
    <column name="File_Size_MB" datatype="decimal(12,2)" />
    <column name="Space_Used_MB" datatype ="decimal(12,2)" />
    <column name="Free_Space_MB" datatype="decimal(12,2)" />
    <column name="FileName" datatype="varchar(500)" />
    <column name="FilePath" datatype="varchar(500)" />
    <column name="GUID" datatype="varchar(50)" />
    
  </table>
  <sql>
    <![CDATA[
 exec model.sys.sp_MSforeachdb
'use [?];
select @@servername as ServerName, getdate() as dtmStamp, DB_NAME() as DBName, [FileID], [File_Size_MB] = convert(decimal(12,2),round([size]/128.000,2)),
[Space_Used_MB] = convert(decimal(12,2),round(fileproperty([name],''SpaceUsed'')/128.000,2)),
[Free_Space_MB] = convert(decimal(12,2),round(([size]-fileproperty([name],''SpaceUsed''))/128.000,2)) ,
[Name], [FileName]
from dbo.sysfiles' 
    ]]>
  </sql>

</root>

